<template>
	<view class="goodsMaxBox">
		<label>
			<view class="goodsCartBox" v-for="(item,index) in list" :key="item.id">
				<view class="goodsCartBoxCentent">
					<!-- 复选框 -->
					<u-checkbox-group>
						<!-- :checked="checkedOne[index]" -->
						<u-checkbox shape="circle" @change="checkboxChange(index,item)" :disabled="isDisabled"
							:checked="item.checked==1?true:false"></u-checkbox>
					</u-checkbox-group>
					<!-- 商品信息 -->
					<view class="goodsInfoMax">
						<view class="overflowBoxItem">
							<view class="goodsInfo">
								<view class="goodsCartInner">
									<view class="goodsmaoshu" @click.stop="checkboxChange(index,item)">
										<u--image :src="item.list_pic_url" mode="scaleToFill" width="88px" s
											height="88px" class="goodsImgSty"></u--image>
										<view class="goodsCartRight">
											<view class="goodsTitle">
												{{item.goods_name}}
											</view>
											<view class="goodsPrice">
												<view>
													<text style="font-size: 24rpx;">¥</text><text
														style="font-size: 32rpx;">{{item.retail_price}}.</text><text
														style="font-size: 24rpx;">00</text>
												</view>
												<view style="color: #969799;font-size: 24rpx;">x{{item.number}}
												</view>
											</view>
										</view>
									</view>
									<!--  @change="valChange" -->
									<view class="numberSty" v-if="isEdit">
										<u-number-box v-model="item.number" @change="changeNumber(item,$event)">
										</u-number-box>
									</view>
								</view>
							</view>
							<button class="button-style" @click.stop="DelFn(item.product_id,index)">删除</button>
						</view>
					</view>
				</view>
			</view>
		</label>
	</view>

</template>

<script>
	export default {
		props: {
			list: {
				type: Array,
				default () {
					return []
				}
			},
			isEdit: {
				type: Boolean,
				default: false
			},
			checkedOne: {
				type: Array,
				default () {
					return []
				}
			},
			isDisabled: {
				type: Boolean,
				default: false
			}
		},
		data() {
			return {
				value: 1
			}
		},
		methods: {
			checkboxChange(index, item) {
				// console.log('change', index);
				this.$emit('changeCheckOne', {
					index,
					item
				})
			},
			DelFn(id, index) {
				this.$emit('DelGoods', {
					id: id,
					index: index
				})
				// console.log(id);
			},
			changeNumber(item, event) {
				this.$emit('changeNumber', item, event)
			},

		}
	}
</script>

<style lang="scss" scoped>
	.goodsMaxBox {
		width: 100vw;
		padding: 0 20rpx;
		box-sizing: border-box;
	}

	.goodsCartBoxCentent {
		width: 100%;
		// height: 250rpx;
		display: flex;
		align-items: center;
		padding: 20rpx 0;
		box-sizing: border-box;
		border-bottom: 1px solid #ccc;

		.goodsInfoMax {
			flex: 1;
			box-sizing: border-box;
			background-color: #fafafa;
			overflow: auto;

			.overflowBoxItem {
				width: calc(100% + 60px);
				display: flex;
				overflow: hidden;

				.goodsInfo {
					width: 100%;
				}

			}

			.button-style {
				width: 60px;
				color: white;
				background-color: red;
				line-height: 120rpx;
				font-size: 32rpx;
				border: none;
				border-radius: 0;
			}

			.goodsCartInner {
				padding: 16rpx 32rpx;
				box-sizing: border-box;
				width: calc(100vw - 44px);

				.goodsmaoshu {
					display: flex;
				}

				.numberSty {
					display: flex;
					justify-content: right;
				}

				.goodsImgSty {
					border-radius: 20rpx;
				}

				.goodsCartRight {
					height: 178rpx;
					display: flex;
					flex-wrap: wrap;
					font-family: "黑体";
					margin-left: 20rpx;

					.goodsTitle {
						font-size: 34rpx;
						margin-top: 40rpx;
					}

					.goodsPrice {
						width: 100%;
						display: flex;
						justify-content: space-between;
						align-items: center;
					}
				}
			}
		}

	}
</style>
